#encoding: utf-8
namespace :contact do
  desc "contact data auto"

  task create: :environment do
    if Contact.chinese.blank?
      simple = Contact.new(phone: '无', fax: '无', address: '无', language: 1)
      if simple.save
        puts "联系我们简体中文创建成功"
      else
        puts "联系我们简体中文创建失败"
      end
    end

    if Contact.english.blank?
      english = Contact.new(phone: 'noting', fax: 'nothing', address: 'nothing', language: 2)
      if english.save
        puts "联系我们英文创建成功"
      else
        puts "联系我们英文创建失败"
      end
    end

    if Contact.traditional.blank?
      traditional = Contact.new(phone: '无', fax: '无', address: '无', language: 3)
      if traditional.save
        puts "联系我们繁体中文创建成功"
      else
        puts "联系我们繁体中文创建失败"
      end
    end
  end
end
